define(['registry', 'config', 'router', 'collections/record_list', 'views/app', 'views/list', 'views/item'],

function(app_registry, config, Router, RecordList, AppView, ListView, ItemView) {

  var App = function() {

    this.routes = new Router();
    this.collections.records = new RecordList();
    this.views.app = new AppView({ collection: this.collections.records });
    this.views.app.render();
    this.views.list = new ListView({ collection: this.collections.records });
    this.views.list.render();
    this.views.item = new ItemView({ collection: this.collections.records })
    this.views.item.render();
    // // this.views.auth = new AuthView();
    // // this.views.auth.render();
    // // this.views.listMenu = new listMenuView({ collection: this.collections.records });

    this.collections.records.fetch({}, { success: function(collection, res, req) {
      Backbone.history.start();
    }});

    ////
    this.app = this.views.app;
    window.TodoRouter = this.routes;
    app_registry.vars.records = this.collections.records;
  };

  App.prototype = {
    collections: {},
    views: {},
  }

  return App;
});
